import {
    UserLayout,
    MainLayout,
    RouteView,
    AppDesignLayout,
    AppMarketLayout,
    InnerLayout
} from '@/layouts'

import ExtendRouters from "@/config/routerextend";
import FormSolutionShow from "@/views/modules/form/core/FormSolutionShow";
import PortalLayoutPreview from "@/views/modules/portal/core/PortalLayoutPreview";
import FormBoListPreview from "@/views/modules/form/core/FormBoListPreview";
import FormCustomView from '@/views/modules/form/core/formComponent/FormCustomView';
import FormCalendarViewShow from "@/views/modules/form/core/FormCalendarViewShow";
import appRouter from "./appRouter.js";

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
    ...appRouter,
    {
        path: '/user',
        component: UserLayout,
        redirect: '/user/login',
        hidden: true,
        children: [
            {
                path: 'login',
                name: 'login',
                component: () => import(/* webpackChunkName: "login" */ '@/views/user/Login')
            },
            {
                path: 'singlelogin',
                name: 'singlelogin',
                component: () => import(/* webpackChunkName: "singlelogin" */ '@/views/user/SingleLogin')
            },
            {
                path: 'ticketLogin',
                name: 'ticketLogin',
                component: () => import(/* webpackChunkName: "ticketLogin" */ '@/views/user/TicketLogin')
            },
            {
                path: 'register',
                name: 'register',
                component: () => import(/* webpackChunkName: "register" */ '@/views/user/Register')
            },
            {
                path: 'mobileCodeLogin',
                name: 'mobileCodeLogin',
                component: () => import(/* webpackChunkName: "forget" */ '@/views/user/MobileCodeLogin')
            },
            {
                path: 'forget',
                name: 'forget',
                component: () => import(/* webpackChunkName: "forget" */ '@/views/user/Forget')
            },
            {
                path: 'qrcodeLogin',
                name: 'qrcodeLogin',
                component: () => import(/* webpackChunkName: "qrcodeLogin" */ '@/views/user/QrcodeLogin')
            },
            {
                path: 'register-result',
                name: 'registerResult',
                component: () => import(/* webpackChunkName: "registerResult" */ '@/views/user/RegisterResult')
            },
            {
                path: 'changePassword',
                name: 'changePassword',
                component: () => import(/* webpackChunkName: "changePassword" */ '@/views/user/ChangePassword')
            },
        ]
    },
    ...ExtendRouters,
    {
        path: '/funs',
        component: MainLayout,
        children: [
            {
                path: 'funs',
                name: 'funs',
                component: () => import('@/views/modules/system/core/MenuViewFuns')
            },
            {
                path: 'funsBlock',
                name: 'funsBlock',
                component: () => import('@/views/modules/system/core/MenuViewFunsBlock')
            },
            {
                path: 'fun',
                name: 'fun',
                component: () => import('@/views/modules/system/core/MenuViewFun')
            },
            {
                path: '/openNewTabForm',
                name: 'openNewTabForm',
                component: FormSolutionShow,
                /** 页签打开表单方案 */
            },
            {
                path: '/custom/FormCustomView/:alias',
                name: 'customView',
                component: FormCustomView
            },
            {
                name:'openDocTab',
                path: '/bpm/workbench/openDocTab/:instId',
                component: () => import('@/views/modules/bpm/workbench/OpenDoc.vue')
            },
            {
                name:'newDocTab',
                path: '/bpm/workbench/newTab/:defKey',
                component: () => import('@/views/modules/bpm/workbench/OpenDoc.vue'),

            },{
                name:'excelImport',
                path: '/webApp/home/FormImportRecordList',
                component: () => import('@/views/modules/form/core/FormImportRecordList')
            },
        ]
    },
    {//列表导入excel预览
        name:'ListExcelImport',
        path: '/FormImportRecordList',
        component: () => import('@/views/modules/form/core/FormImportRecordList')
    },
    {//列表设计
        path:'/formbolistedit',
        name:'FormBoListEdit',
        props:true,
        component:()=> import('@/views/modules/form/core/FormBoListEdit')
    },
    {//树型对话框
        path:'/formbolisttreeedit',
        name:'FormBoListTreeEdit',
        props:true,
        component:()=> import('@/views/modules/form/core/FormBoListTreeEdit')
    },
    {//列表设计
        path:'/formbolisttreeedit',
        name:'FormBoListTreeEdit',
        props:true,
        component:()=> import('@/views/modules/form/core/FormBoListTreeEdit')
    },
    {
        path: '/org',
        component: MainLayout,
        children: [
            {
                path: 'osGroupList',
                name: 'osGroupList',
                component: () => import('@/views/modules/user/org/OsGroupList.vue')
            }]
    },
    {
        path: '/portal',
        component: MainLayout,
        children: [{
            path: 'InsNewsIssueds',
            name: 'InsNewsIssueds',
            component: () => import('@/views/modules/portal/core/InsNewsIssueds')
        }
        ]
    },
    {
        path: '/404',
        component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
    }, {
        path: '/bpmInst',
        component: RouteView,
        children: [
            {
                path: 'startDefId/:defId/:instId',
                name: 'startDefId',
                component: () => import('@/views/modules/bpm/core/BpmInstStart')
            },
            {
                path: 'startDefKey/:defKey/:instId',
                name: 'startDefKey',
                component: () => import('@/views/modules/bpm/core/BpmInstStart')
            },
            {
                path: 'detail/:instId',
                name: 'detail',
                component: () => import('@/views/modules/bpm/core/BpmInstDetail')
            }
        ]
    }, {
        path: '/bpmTask',
        component: RouteView,
        children: [
            {
                path: 'start/:taskId/:instId',
                name: 'bpmTaskStart',
                component: () => import('@/views/modules/bpm/core/BpmTaskStart')
            }
        ]
    }, {
        path: '/customform/:formAlias/:pkId',
        name: 'customform',
        component: FormSolutionShow,
    },
    {
        path: '/customFormRead/:formAlias/:pkId',
        name: 'customFormRead',
        component: FormSolutionShow,
    },
    {
        path: '/customform/:formAlias',
        name: 'customformNoPk',
        component: FormSolutionShow,
    }, {
        path: '/formprint/:formAlias/:pkId',
        name: 'formprint',
        component: () => import('@/views/modules/form/core/FormSolutionPrint')
    }, {
        path: '/formprint/:formAlias',
        name: 'formprintNoPk',
        component: () => import('@/views/modules/form/core/FormSolutionPrint')
    }, {
        path: '/flowprint/:defId/:instId',
        name: 'flowprint',
        component: () => import('@/views/modules/bpm/core/BpmInstPrint.vue')
    },
    {
        path: '/customportal/:alias',
        name: 'customportal',
        component: PortalLayoutPreview
    },
    {
        path: '/list/:listKey',
        name: 'formBoList',
        component: FormBoListPreview
    },
    {
        path: '/editPage',
        component: MainLayout,
        children: []
    },
    {
        path: '/FormCustomView/:alias',
        name: 'FormCustomView',
        component: FormCustomView
    },
    /**
     * encryParams 为加密参数
     * {
     *     alias:别名,
     *     publicity:默认false 是否对外公开,
     *     userId:分享人ID
     * }
     */
    {
        path: '/FormCustomShare/:encryParams',
        name: 'FormCustomShare',
        component: FormCustomView
    }, {
        path: '/market',
        name: 'market',
        component: AppMarketLayout,
        children:
            [
                {
                    path: 'authorize',
                    name: 'authorize',
                    component: () => import('@/views/application/ApplicationAuthorize')
                },
                {
                    path: 'appInstallList',
                    name: 'appInstallList',
                    component: () => import('@/views/modules/system/core/SysAppInstallList')
                },

            ]
    },{
        name:'newDoc',
        path: '/bpm/workbench/new/:defKey',
        component: () => import('@/views/modules/bpm/workbench/OpenDoc.vue')
    },{
        name:'openDoc',
        path: '/bpm/workbench/openDoc/:instId',
        component: () => import('@/views/modules/bpm/workbench/OpenDoc.vue')
    },{
        name:'openFormDoc',
        path: '/form/workbench/editForm/:pkId',
        component: () => import('@/views/modules/form/workbench/OpenFormDoc.vue')
    },{
        name:'bpmAuthByUser',
        path: '/bpm/core/bpmAuthByUser/:userId',
        component: () => import('@/views/modules/bpm/core/BpmAuthListByUser.vue')
    },{
        name:'bpmAuthByProcess',
        path: '/bpm/core/bpmAuthByProcess/:defKey',
        component: () => import('@/views/modules/bpm/core/bpmAuthList/BpmAuthListByProcess.vue')
    },
    //模板编辑
    {
        name:'messageEdit',
        path: '/bpm/bpm/core/message/:defId/:nodeId/:boAlias',
        component: () => import('@/views/modules/bpm/core/BpmMessageTemplateEdit.vue')
    },
    //意见模板
    {
        name:'opinionTemplate',
        path: '/bpm/bpm/core/opinion/:defId/:nodeId/:boAlias',
        component: () => import('@/views/modules/bpm/core/BpmOpinionTemplate.vue')
    },
    {//微前端路由
        path: '/appPortalHome/*',
        name:'appPortalHome',
        component: MainLayout
    },
    {
        path: '/calendarView/:calendarKey',
        name: 'FormCalendarViewShow',
        component: FormCalendarViewShow
    },
    {
        path: '/AccomplishBpm',
        name: 'AccomplishBpm',
        component: () => import('@/views/modules/bpm/workbench/AccomplishBpm.vue')
    },
    {
        path:"/admin",
        component: MainLayout,
        children: [
            {
                path: '',
                name: 'admin-index',
                component: () => import('@/views/application/ApplicationIndex')
        }]

    },
    {
        path: '/',
        component: MainLayout,
        children: [
            {
                path: '',
                name: 'home-index',
                component: () => import('@/views/dashboard/index')
            },
            {
                path: '/MyBpmTaskList',
                name: 'MyBpmTaskList',
                component: () => import('@/views/modules/bpm/ws/MyBpmTaskList')
            },{
                path: '/MyTracked',
                name: 'MyTracked',
                component: () => import('@/views/modules/bpm/ws/MyTracked')
            },{
                path: '/MyBpmInstList',
                name: 'MyBpmInstList',
                component: () => import('@/views/modules/bpm/ws/MyBpmInstList')
            },{
                path: '/MyApprovedTasks',
                name: 'MyApprovedTasks',
                component: () => import('@/views/modules/bpm/ws/MyApprovedTasks.vue')
            },{
                path: '/myTurnTo',
                name: 'myTurnTo',
                component: () => import('@/views/modules/bpm/ws/MyTurnTo.vue')
            },{
                path: '/myPending',
                name: 'myPending',
                component: () => import('@/views/modules/bpm/core/BpmPendingRecordList')
            },{
                path: '/MyTransOutTask',
                name: 'MyTransOutTask',
                component: () => import('@/views/modules/bpm/ws/MyTransOutTask.vue')
            },{
                path: '/MyReceiveTask',
                name: 'MyReceiveTask',
                component: () => import('@/views/modules/bpm/ws/MyReceiveTask.vue')
            },{
                path: '/myReceiveCopy',
                name: 'myReceiveCopy',
                component: () => import('@/views/modules/bpm/ws/MyReceiveTurn.vue')
            },{
                path: '/MyConcern',
                name: 'MyConcern',
                component: () => import('@/views/modules/bpm/ws/MyConcern.vue')
            },{
                path: '/asyncTask',
                name: 'asyncTask',
                component: () => import('@/views/modules/bpm/core/BpmAsyncTaskList.vue')
            },{
                path: '/BpmDefForStart',
                name: 'BpmDefForStart',
                component: () => import('@/views/modules/bpm/ws/BpmDefForStart')
            },{
                path: '/form/core/FormDataSourceDefList',
                name: 'formDataSourceDefList',
                component: () => import('@/views/modules/form/core/FormDataSourceDefList')
            },{
                path: '/webApp/innerMsgs/InfInnerMsgList',
                name: 'InfInnerMsgList',
                component: () => import('@/views/modules/portal/core/InfInnerMsgList')
            }


        ]
    }

]
